package com.yupi.ojjudge.judge;

import com.yupi.ojjudge.judge.strategy.DefaultJudgeStrategy;
import com.yupi.ojjudge.judge.strategy.JavaJudgeStrategy;
import com.yupi.ojjudge.judge.strategy.JudgeContext;
import com.yupi.ojjudge.judge.strategy.JudgeStrategy;
import com.yupi.ojjudge.judge.model.JudgeInfo;
import com.yupi.ojjudge.model.entity.QuestionSubmit;

/**
 * @Author ortonzhu
 * @Date 2024/10/19 14:00
 * 判题管理
 */
public class JudgeManage {

    JudgeInfo doJudge(JudgeContext judgeContext) {
        QuestionSubmit questionSubmit = judgeContext.getQuestionSubmit();
        String language = questionSubmit.getLanguage();
        JudgeStrategy JudgeStrategy = new DefaultJudgeStrategy();
        if (language.equals("java")) {
            JudgeStrategy = new JavaJudgeStrategy();
        }
        return JudgeStrategy.doJudge(judgeContext);
    }
}
